package test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Dingo
 */
public class Regexp {

    public static void main(String[] args) throws FileNotFoundException, IOException {
        BufferedReader in = new BufferedReader(new FileReader("D:\\Inne\\eksperyment\\pear\\pctr.html"));

        StringBuilder reply = new StringBuilder();
        String reply_now;
        while ((reply_now = in.readLine()) != null) {
            reply.append(reply_now);
        }
        in.close();

        Pattern p = Pattern.compile("codedirect\" value=\"([^\"].)+");
        Matcher m = p.matcher(reply);
        m.find();
        String tmp = m.group();
        String link = tmp.split("\"")[2];
       // System.out.println(reply.substring(m.start(), m.end()));
        System.out.println(link);
    }
}
